<script setup lang="ts">
import {onMounted, ref} from "vue";
import {showFailToast, showSuccessToast} from "vant";
import {getCurrentUser} from "../services/user.ts";

const user = ref()

onMounted(async ()=> {
  const res = await getCurrentUser();
  if (res) {
    user.value = res;
    showSuccessToast('获取用户信息成功')
  } else {
    showFailToast('获取用户信息失败');
  }
})
</script>

<template>
    <template v-if="user">
      <van-cell title="当前用户" :value="user?.username" />
      <van-cell title="修改信息" is-link to="/user/update" />
      <van-cell title="我创建的队伍" is-link to="/user/team/create" />
      <van-cell title="我加入的队伍" is-link to="/user/team/join" />
    </template>
</template>

<style scoped>

</style>